<?php

class Ext_Controller_Action_Front extends Ext_Controller_Action
{
    public function init()
    {
        parent::init();
        
        Zend_Registry::set('_use_adapter', 'slave');
    }

    public function preDispatch()
    {
        parent::preDispatch();
        
        $settings = Zend_Registry::get("settings");
        $this->view->settings = $settings;
        
        $userId = Ext_Auth_Front::getInstance()->getIdentity();
        if($userId == 1){
            return "";
        }

        $moduleName         = $this->_request->getModuleName();
        $controllerName     = $this->_request->getControllerName();
        $actionName         = $this->_request->getActionName();
        
        if($moduleName == 'default' || $moduleName == 'account')
        {
            return "";
        }
        if($moduleName == 'publish' || $moduleName == 'setup')
        {
            
            if(!$userId){
                $this->_forward("show-please-login", "auth", "account");
            }
        }
    }
}
